Play-silhouette-seed - social authentication not working


#1

I have downloaded the play-silhouette-seed github project to learn how silhouette works (https://github.com/mohiva/play-silhouette-seed).

I have built and run it succesfully with intellij idea. Signing up and in with credentials works fine but I cannot manage to use social authentication. For example, when I try to use google authentication, I am redirected to google accounts and told the following:

  1. That’s an error.
    Error: invalid_request
    Missing required parameter: client_id

I have the same with almost all social authentication proposed in the project. Facebook gives me the following message:

{
“error”: {
“message”: “Missing client_id parameter.”,
“type”: “OAuthException”,
“code”: 101,
“fbtrace_id”: “DHBLldWYEMy”
}
}

When I try to use the working example provided in the readme file (https://play-silhouette-seed.herokuapp.com/), everything works fine, so I have no clue about why it’s not working with the downloaded project. Can someone tell me the reason and how to fix it?

I am new to backend development and play, so please perdon me if my question is not well explained and do not hesitate to ask for further details.

Thanks a lot


#2

Hi,

Have you read the documentation section about the configuration of the social providers? Have you provided the credentials for the social providers?

Best regards,
Christian


#3

Thank you for your answer Christian. I have read the article about providers (https://www.silhouette.rocks/docs/providers), is it the one you are talking about?

What do you mean by providing the credentials to the social providers and how can I do it (cannot find info about it in the documentation)?

I have also read the article about social state (https://www.silhouette.rocks/docs/config-social-state) which states that secureCookie should be disabled for testing on localhost without SSL, otherwise cookie couldn’t be set.
I wanted to modify secureCookie to false just to check if it changes something but do not know where to modify it.

As I said, I am still new to backend development, so sorry if my questions are naive.


#4

Thank you for your answer Christian. I have read the article about providers (https://www.silhouette.rocks/docs/providers), is it the one you are talking about?

With the configuration section I meant this page: https://www.silhouette.rocks/docs/config-introduction

Under this section, there exists a page for every part that can be configured for Silhouette. You can find the social provider (Oauth1, OAuth2, OpenID) specific configuration there.

The Silhouette seed template uses the configuration mechanism provided by Play. The Silhouette specific configuration file is located here: https://github.com/mohiva/play-silhouette-seed/blob/master/conf/silhouette.conf

The application.prod.conf file is the configuration that targets the deployment on Heroku. It overrides the values from silhouette.conf.

What do you mean by providing the credentials to the social providers and how can I do it (cannot find info about it in the documentation)?

As example, If you implement Facebook authentication, then you must create an app on Facebook. For this app you get an client ID and a client secret. You must also configure the redirect URI for your app. This values must then be passed to the configuration.

I wanted to modify secureCookie to false just to check if it changes something but do not know where to modify it.

The option secureCookie is disabled by default if you start Play in development mode because it used the default application.conf which inherits the silhouette.conf.

In my opinion you should try to understand how Play works. Then you should try to understand the OAuth2 flow. Then you should try to understand how Silhouette works. This makes it easier for you.

Best regards,
Christian


#5

Thank you for this clear and detailed explanation and the guidelines! I will focus on what you suggested and try to make it work. I will come back if I struggle on some points.

Best regards,

Mikael