gazuntype / graphQL-client-unity

This repository houses a unitypackage that can be included in your Unity Project to enable it communicate with a graphQL server.
Apache License 2.0
292 stars 50 forks source link

Select type of Authentication #14

Open bocklucas opened 4 years ago

bocklucas commented 4 years ago

First off, kick ass package! This is absolutely amazing, phenominal work!! :tada:

I would like to request the ability to add what type of Auth is used when making requests. I noticed you've been using Bearer, however for the GraphQL APIs I'm using, the method we use is JWT.

It would be great if there was a AuthConstants.cs file, containing say

# AuthConstants.cs
public class AuthMethod {
   public const string BEARER = "Bearer";
   public const string JWT = "JWT";
...
}

and you could reference the Auth method you wished when setting the auth token, i.e.

myGraphQLReference.SetAuthToken(AuthMethod.BEARER, myToken);

Just a thought! Might save some others time who maybe aren't using Bearer as their source of API auth.

Thanks!!

jnalfaro commented 3 years ago

I am learning how to code for my summer break. Do you know how I would do it for Basic Auth?

bocklucas commented 3 years ago

Hey @jnalfaro awesome! Could you clarify what you mean by "do it for Basic Auth"?