From the documentation I understand that the answer is yes:
https://help.salesforce.com/s/articleView?id=sf.remoteaccess_oauth_user_agent_flow.htm&type=5
But if I try I can't get it.
I am working on a web application that allows any user to connect with its salesforce account.
I've implemented User-Agent Flow and I obtain correctly access_token and other info but I can't obtain refresh_token, even if I have the correct scopes (api, web, refresh_token, offline_access).
This is my request:
And my redirect URL is: http://[MYSITE].com/#/services/oauth2/success
(that corresponds to the host from where I make the call)
This call correctly gives me access_token but not refresh_token.
If I use "https" instead of "http" I receive this error:
error=invalid_scope&error_description=the requested scope is not available
From the documentation, I read that:
"The refresh token for the user-agent flow is only issued if you requested scope=refresh_token and one of the following scenarios is true:
....
- The redirect URL host matches the request host and includes the servlet services/oauth2/success.
... "
I think to be in this case, what am I doing wrong?
I've also considered to use web-agent flow, but I guess that I can't provide connection to any user from any organization with that flow. Is it right?
Thanks in advance for any hints