Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URGENT: Web API Bug -> Overloaded methods no longer being found! #15

Closed
dellams opened this issue Feb 18, 2021 · 0 comments
Closed

URGENT: Web API Bug -> Overloaded methods no longer being found! #15

dellams opened this issue Feb 18, 2021 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@dellams
Copy link
Collaborator

dellams commented Feb 18, 2021

On the WEB API there is a overload for each method call allowing the providertype and setglobally params to be passed in overriding the default provider.

For example using Postman you could call:

http://localhost:5000/api/avatar/authenticate to auth with the default provider

Body text: (POST)

{
"email": "davidellams@hotmail.com",
"password": "my-super-secret-password"
}

You could then call:
http://localhost:5000/api/avatar/authenticate/MongoDBOASIS/false

to override the default provider with 1st param, in this case it is the MongoDBOASIS Provider. The 2nd param is the setGlobally flag, if true then it will set this provider as the new default provider for future calls, or false for it to only override on this one call.

THIS USE TO WORK FINE AND NOW FOR SOME REASON IT HAS STOPPED WORKING!

Nothing has been changed or updated so very odd for it all of a sudden to stop working?! I do not have time to fix this, it really makes no sense to me and needs fixing ASAP please!

    /// <summary>
    /// Authenticate and log in using the given avatar credentials. Pass in the provider you wish to use. Set the setglobally flag to false for this provider to be used only for this request or true for it to be used for all future requests too.
    /// </summary>
    /// <param name="model"></param>
    /// <param name="providerType"></param>
    /// <param name="setGlobally"></param>
    /// <returns></returns>
    [HttpPost("authenticate/{providerType}/{setGlobally}")]
    public ActionResult<AuthenticateResponse> Authenticate(AuthenticateRequest model, ProviderType providerType = ProviderType.Default, bool setGlobally = false)
    {
        GetAndActivateProvider(providerType, setGlobally);
        return Authenticate(model);

        AuthenticateResponse response = _avatarService.Authenticate(model, ipAddress());

        if (!response.IsError && response.Avatar != null)
            setTokenCookie(response.Avatar.RefreshToken);

        return Ok(response);
    }

    
    /// <summary>
    /// Authenticate and log in using the given avatar credentials.
    /// </summary>
    /// <param name="model"></param>
    /// <returns></returns>
    [HttpPost("authenticate")]
    public ActionResult<AuthenticateResponse> Authenticate(AuthenticateRequest model)
    {
        AuthenticateResponse response = _avatarService.Authenticate(model, ipAddress());

        if (!response.IsError && response.Avatar != null)
            setTokenCookie(response.Avatar.RefreshToken);

        return Ok(response);
    }

Full code here:

https://github.com/NextGenSoftwareUK/Our-World-OASIS-API-HoloNET-HoloUnity-And-.NET-HDK/blob/master/NextGenSoftware.OASIS.API.ONODE.WebAPI/Controllers/AvatarController.cs

This may also be related to #14 in someway? But I feel they are separate issues and both need fixing ASAP! Thank you.

THANK YOU.

@dellams dellams added bug Something isn't working help wanted Extra attention is needed labels Feb 18, 2021
@dellams dellams changed the title Web API Bug -> Overloaded methods no longer being found! URGENT: Web API Bug -> Overloaded methods no longer being found! Feb 18, 2021
@dellams dellams closed this as completed Mar 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant