I know this question was asked early last year in the below thread:
However, I am not looking at converting my account to a plex account. I have this working for basic authentication just not OAuth.
Is it possible to get the plex authorisation token from Google Auth and/or Facebook auth using c# (or any language in that manner) or is this only possible using basic authentication with a username and password?
Can you please elaborate on why?
Is there something that actually stops this?
How can Ombi do this? Is there a signin page I should redirect to instead for plex that returns the API token?
I’m not sure how Ombi does it, but when the API mentioned in that guide is designed to only work with a regular Plex login information. There is no way to pass the Google authentication information. The apps use a different method to gain the token when using a Google account. AFAIK, it’s not as simple as passing a username and password in a single API call.
1.List item POST request to https://plex.tv/api/v2/pins?strong=true with headers:
Accept:application/json
X-Plex-Product: [your product]
X-Plex-Version:Plex OAuth
X-Plex-Client-Identifier: [your client identifier]
X-Plex-Model:Plex OAuth
it returns json, save keys id (later referred as pin) and code;
List item to navigate to plex.tv pop up tab to choose login form (plex, google, fb) create url as it follows
https:/ /app.plex.tv/auth/#!?clientID=YOURCLIENTID&context[device][version]=Plex OAuth&context[device][model]=Plex OAuth&code=CODESAVEDBEFORE&context[device][product]=Plex Web
the last is important in both value and location, it won’t work otherwise
3. List item do the login process and close tab.
4. List item with pin you got before from first POST request:
Happy to help and share, spent a whole day trying to get it to work for my android app . Let me know if you somehow get the facebook OAuth to work, as i have been unable to do so.
PS: if you find yourself trying to access shared libraries logging as a “friend” account later on, you’ll need a bit of a workaround with another API call to check server ownership and change token according to that. I’ll leave here the code in javascript, I’m sure once you get the gist of it you can convert it to C# (you’ll need to parse XML with your C# lib of choice).